﻿<UserControl x:Class="XamlTorrent.Managers.UriGetter.UI.CreateUriTask"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:validation="clr-namespace:XamlTorrent.Common.Validation;assembly=XamlTorrent.Common"
    Name="CreateUriTaskElement">
    <Grid Margin="3">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right">URL</Label>
        <TextBox Name="fileUri" Grid.Row="0" Grid.Column="1" Margin="0,0,0,2" HorizontalAlignment="Stretch" VerticalAlignment="Center">
            <TextBox.Text>
                <Binding ElementName="CreateUriTaskElement" Path="SourceUri">
                    <Binding.ValidationRules>
                        <validation:ValueRequiredRule />
                        <validation:UriValidationRule UriKind="Absolute" />
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <Label Grid.Row="1" HorizontalAlignment="Right">Checksum</Label>
        <DockPanel Grid.Row="1" Grid.Column="1">
            <ComboBox Name="hashAlgorithm" SelectedIndex="0" DockPanel.Dock="Right" VerticalAlignment="Center">
                <ComboBoxItem Content="MD5" />
                <ComboBoxItem Content="SHA1" />
                <ComboBoxItem Content="SHA256" />
                <ComboBoxItem Content="SHA384" />
                <ComboBoxItem Content="SHA512" />
                <ComboBoxItem Content="RIPEMD160" />
            </ComboBox>
            <TextBox Name="fileChecksum" Margin="0,0,0,2" VerticalAlignment="Center">
                <TextBox.Text>
                    <Binding ElementName="CreateUriTaskElement" Path="Checksum">
                        <Binding.ValidationRules>
                            <validation:Base16ValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
        </DockPanel>
        <Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right">Save To</Label>
        <DockPanel Grid.Row="2" Grid.Column="1">
            <Button Name="browseSavePath" DockPanel.Dock="Right" Padding="5,0,5,0" Content="..." Click="browseSavePath_Click" />
            <TextBox Name="savePath" Margin="0,0,0,2" VerticalAlignment="Center">
                <TextBox.Text>
                    <Binding ElementName="CreateUriTaskElement" Path="SavePathStr">
                        <Binding.ValidationRules>
                            <validation:ValueRequiredRule />
                            <validation:PathValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
        </DockPanel>
    </Grid>
</UserControl>
